package com.zhkc.iess.system;

import com.alibaba.csp.sentinel.Entry;
import com.alibaba.csp.sentinel.SphU;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.alibaba.csp.sentinel.slots.block.RuleConstant;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
import com.zhkc.wisdom.common.feign.annotation.ZhkcCloudApplication;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;

import java.util.ArrayList;
import java.util.List;

@ZhkcCloudApplication
@EnableFeignClients(basePackages = {"com.zhkc.iess.model.client.feign"})
@MapperScan("com.zhkc.iess.system.mapper")
public class Service02Application {

    public static void main(String[] args) {
        SpringApplication.run(Service02Application.class, args);
    }

//    public static void main(String[] args) {
//        SpringApplication.run(Service02Application.class, args);
//        initFlowRules();
//    }
//
//    private static void initFlowRules(){
//        List<FlowRule> rules = new ArrayList<>();
//        FlowRule rule = new FlowRule();
//        rule.setResource("/api/auth/pageList"); // 资源名
//        rule.setGrade(RuleConstant.FLOW_GRADE_QPS); // 限流阈值类型，0表示线程数，1表示QPS
//        rule.setCount(1); // 限流阈值，对应QPS为5
//        rules.add(rule);
//        FlowRuleManager.loadRules(rules); // 加载规则
//    }

}
